{include file="Public:header" /}
<body>
<!-- ueditor编辑器 -->
<script type="text/javascript" charset="utf-8" src="__STATIC__ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__STATIC__ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="__STATIC__ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" charset="utf-8" src="__STATIC__laydate/laydate.js"></script>

<div class="wrap">
    <!--碎屑路径-->
    <div class="debris_nav">
        <ol class="breadcrumb">
            <li><a href="#">系统设置</a></li>
            <li class="active">网站设置</li>
        </ol>
    </div>
    <div class="blank"></div>
    <!--列表内容-->
    <div class="content" id="content_page">
        <form method="post" action="{:url('article/edit_ok')}">
            <input type="hidden" name="id" value="{$info.id}">
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab_add">
            <tr>
                <td valign="top">文章分类</td>
                <td>
                    <select name="pid" class="form-control" >
                        {$res.opt}
                    </select>
                    <a href="{:url('category/add')}?pid=1">添加分类</a>
                </td>
            </tr>
            <tr>
                <td valign="top">标题</td>
                <td>
                    <input name="title" value="{$info.title}" class="form-control" placeholder="请填写标题" size="70"><br>
                    <span class="note"><i class="iconfont icon-iconfontmoban"></i>标题请勿超过60个字节</span>
                </td>
            </tr>
            <tr>
                <td valign="top">SEO关键字</td>
                <td>
                    <input name="keyword" value="{$info.keyword}" class="form-control" placeholder="" size="60"><br>
                    <span class="note"><i class="iconfont icon-iconfontmoban"></i>标题请勿超过60个字节</span>
                </td>
            </tr>
            <tr>
            <td valign="top">推荐{$info.is_top}</td>
            <td>
                <div class="checkbox_text ">
                    {volist name="$res.recommend" id="vo"}
                    <label class="checkbox" ><input name="{$vo.extend}" type="checkbox" value="{$vo.id}" {if condition="$info[$vo.extend]"}checked{/if}/>{$vo.name}</label>
                    {/volist}<br>
                 </div>
            </td>
            </tr>
            <tr>
                <td valign="top">标签</td>
                <td>
                    <div class="checkbox_text ">
                        {volist name="$res.tag" id="vo"}
                        <label class="checkbox" ><input name="tag[]" type="checkbox" value="{$vo.id}" {if condition="strstr($info['tag'],''.$vo['id'].'') eq true"} checked {/if} />{$vo.name}</label>
                        {/volist}
                    </div>
                </td>
            </tr>
            <tr>
                <td valign="top">相册集</td>
                <td>
                    <!-- 相册集上传-->
                    <button type="button" class="btn btn-success" onClick="upImage()">上传图片</button> <input type="hidden" id="li-pointer" value="">

                    <div id="thumb_str" style="display: none;">{$info.thumb}</div>
                    <div class="up-box clearfix">
                        <ul id="up-append">
                        </ul>
                    </div>
                    <div id="up_edit" style="display: none;" title="隐藏的编辑器"></div>
                    <!-- 相册集上传 -->
                </td>
            </tr>
            <tr>
                <td valign="top">描述</td>
                <td>
                    <input name="desc" value="{$info.desc}" class="form-control" placeholder="" size="60"><br>
                    <span class="note"><i class="iconfont icon-iconfontmoban"></i>标题请勿超过100个字节</span>
                </td>
            </tr>
            <tr>
                <td valign="top">发布时间</td>
                <td>
                    <span class="laydate"><label><input class="form-control Wdate" type="text" id="start" name="add_time" value="{$info.format_add_time}" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"/></label>
                    <label class="laydate-icon"></label></span>
                </td>
            </tr>
            <tr>
                <td valign="top">内容</td>
                <td>
                   <textarea id="editor" name="content" style="width:90%;height:300px;">{$info.content}</textarea>
                </td>
            </tr>

            <tr>
                <td valign="top">审核</td>
                <td>
                    <select name="is_status" class="form-control">
                        {$res.is_check}
                    </select>

                </td>
            </tr>

            <tr>
            <tr>
                <td valign="top"></td>
                <td>
                    <input type="submit" class="btn" value="确定">
                </td>
            </tr>
            <tr>
        </table>
            </form>
    </div>
    <!--列表内容-->
</div>
</body>
<script>
    $(document).ready(function(){

        /*初始化相册内容*/
        // 获取相册内容并且转数组格式
        $thumb_str = $('#thumb_str').text();
        var arg = eval('(' + $thumb_str + ')');
        DivShow(arg);

        // 初始化指针位置
        $l = $("#up-append li").length;
        $("#li-pointer").val($l);


    });
    /*封面上传*/
    var up = UE.getEditor('up_edit');
    //弹出图片上传的对话框
    function upImage()
    {
        var myImage = up.getDialog("insertimage");
        myImage.open();
    }
    //监听图片上传
    up.addListener('beforeInsertImage', function (t,arg)
    {
        DivShow(arg);
    });

    // 显示div
    function DivShow(arr){
        var $str='';
        // 数组长度
        var $arr_length = arr.length;
        // 获取li指针位置
        $length = Number($("#li-pointer").val());


        for(i=0;i<$arr_length;i++){
            $ii = $length+i;
            //alert($ii);
            $str += "<li class='list_"+$ii+"'>";
            $str+= "<input name='up-thumb[]' id='up-thumb-"+i+"' type='hidden' value='"+arr[i].src+"'>";
            $str +="<div class='img'><img src='"+arr[i].src+"' /></div>";

            $str +="<input name='up-title[]' id='up-title-"+i+"' value='"+arr[i].title+"' class='input' placeholder='请设置标题'>"

            if(arr[i]['top'] ==1){
                $str +="<label class='pull-left'><input name='up-top' type='radio' value='"+$ii+"' checked>设置封面 </label>"
            }else{
                $str +="<label class='pull-left'><input name='up-top' type='radio' value='"+$ii+"'/>设置封面 </label>"
            }
            $str +="<label class='pull-right' class='delete'><i class='iconfont icon-shanchu delete' onclick='dele_list("+$ii+")'></i></label>";
            $str += "</li>";
        }

        $(".up-box").css('display','block');
        $("#up-append").append($str)

        // 重新生成指针位置
        $t =  parseInt($length)  + $arr_length;
        $("#li-pointer").val($t);

    }
    // 删除
    function dele_list($id){
        $(".list_"+$id).remove();
    }

    /*kindeditor 编辑器*/
    var ue = UE.getEditor('editor');

    /*日期控件*/
    var start = {
        elem: '#start',
        format: 'YYYY/MM/DD hh:mm:ss',
        min: laydate.now(), //设定最小日期为当前日期
        max: '2099-06-16 23:59:59', //最大日期
        istime: true,
        istoday: false,
        choose: function(datas){
            end.min = datas; //开始日选好后，重置结束日的最小日期
            end.start = datas //将结束日的初始值设定为开始日
        }
    };



</script>
</html>